home *** CD-ROM | disk | FTP | other *** search
- TITLE: collected MS-DOS secrets
- Some MS-DOS info 86/08/28
- ================
-
- (collected from ms.dos/secrets)
-
-
- Function 34h: Return INDOS flag location
-
- on entry: AH = 34h
- on exit: ES:BX = pointer to the "INDOS" flag - a byte
- which is non-zero when DOS is busy and
- shouldn't be called.
-
- Notes: It seems that this flag shouldn't be trusted. The
- proper way to determine if a routine is busy is to
- intercept calls to it - set a flag when it gets a
- call, and reset the flag when it returns.
-
-
- Function 37h: Get/Set Switch Char, Device Availability Flag
-
- on entry: AH = 37h
- AL = 0 = get switch char
- 1 = set switch char
- 2 = get device availability flag
- 3 = set device availability flag
- DL = if AL is 1 or 3,
- DL contains the switch char
- or the device availability flag
-
- on exit: DL = if AL was 0 or 2,
- DL contains the switch char
- or the device availability flag
-
- Notes: The switch character is the character which precedes
- options on a command line. Normally, this character
- is the forward slash ('/').
- The device availability flag is true if devices
- must be referenced as being in the "\DEV\" directory.
- If the flag is false, it isn't necessary to prefix
- the device name with "\DEV\".
-
-
-
- Function 4Bh: EXEC
-
- on entry: AH = 4Bh
- AL = function number - 0 = load and exec
- 1 = same as 0 but don't exec
- 2 = load overlay
- DS:DX = pointer to the command name to load
- ES:BX = pointer to the parameter block
-
- on exit: AX = error codes if carry flag set
-
- Notes: AL=0 Load and Execute the program.
- This subfunction creates a PSP, using the return
- address from the caller as the values for the Terminate
- and Control Break exit handlers. The program whose
- name is passed throught DS:DX is loaded and executed.
-
- AL=1 Load, don't EXEC.
- This subfunction is used by DEBUG.COM and the Manx
- debugger, DB.EXE. It creates the PSP as per subfunction
- 0 above, but doesn't execute it. The SS:SP and CS:IP
- registers that would have been set for the EXEC are
- instead stored in the four words following the
- parameter block.
-
- AL=3 Load overlay.
- This function simply loads the program. No PSP is
- created.
-
- The Parameter Block:
-
- AL=0 WORD = segment address of environment strings
- DWORD = pointer to command line to pass
- DWORD = pointer to first default FCB
- DWORD = pointer to second default FCB
- AL=1 WORD = segment address of environment strings
- DWORD = pointer to command line to pass
- DWORD = pointer to first default FCB
- DWORD = pointer to second default FCB
- DWORD = initial SS:SP for the loaded program
- DWORD = initial CS:IP for the loaded program
-
- AL=3 WORD = segment address to load the overlay into
- WORD = relocation factor to be applied to the overlay
-
-
- Function 50h: Set PSP location
-
- on entry: AH = 50h
- BX = Segment address of the PSP to become current
-
- on exit: (none)
-
- Notes: DOS thinks that the PSP starts at the location
- passed in BX.
-
-
- Function 51h: Get PSP location
-
- on entry: AH = 51h
-
- on exit: BX = Segment address of the current PSP
-
- Notes: same as function 62h. Returns the segment address
- of the "currently executing process."
-
- Function 55h: Create new PSP
-
- on entry: AH = 55h
- DX = Segment address of the new PSP
- SI = Value to be used as the word at [PSP+2]
-
- on exit: (none)
-
- Notes: similiar to function 26h.
-
-
- DOS PSP Format:
- ---------------
-
- 00 - Int 20h
- 02 - Segment address of top of memory
- 04 - not used
- 05 - CALL FAR op-code
- 06 - word size in bytes of this segment, rounded down to nearest para
- 08 - word chosen to cause the CALL far at 05h to reach the jump at 0:C0
- 0A - INT 22h (TERMINATE) vector to be restored on exit
- 0E - INT 23h (CTRL-BREAK) vector
- 12 - INT 24h (CRITICAL ERROR) vector
- 16 - segment address of the parent process's PSP
- 18 - 20 byte "alias table," contains one byte for each open file. The
- byte relates the process's file number to the DOS file number. Bit
- 7 of the byte is set if the file is not inherited by the process's
- children. If the byte is 0ffh, the there isn't a file associated
- with it.
- 2C - segment address of the passed environment table
- 2E - dword in which DOS stores the callers SS:SP regs when switching
- to its internal stack.
- 32 - word containing the maximum number of open files for this process.
- the default value is 20.
- 34 - dword pointer to the "alias table," defaults to PSP:18h.
- 38 - (? dword -1)
- 50 - INT 21h
- 52 - RET far
- 5C - First default FCB
- 6C - Second default FCB (located in second half of first FCB)
- 80 - byte number of characters in the command line
- 81 - start of the command line. The command line ends in a carriage
- return.
-
-
- DOS Memory Control Blocks:
- --------------------------
-
- Memory control blocks are paragraph aligned. The first byte is a signature
- byte with a value of either 4Dh or 5Ah. A signature of 5Ah indicates that the
- block is the last in the chain. The signature is followed by a word containing
- the PSP address of the owner of the block. The next word contains the size, in
- paragraphs, of the block.
-
-
-